//
//  SSSRecordOrderToRecordDailyDetailViewController.m
//  SSSMerchant
//
//  Created by 谢曦 on 2017/3/26.
//  Copyright © 2017年 xnxin. All rights reserved.
//

#import "SSSRecordOrderToRecordDailyDetailViewController.h"
#import "SSSRecordOrderToRecordDailyDetailCell.h"
@interface SSSRecordOrderToRecordDailyDetailViewController ()
{
    CGFloat _totalUploadMoney;
}
@end

@implementation SSSRecordOrderToRecordDailyDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    self.title=[NSString stringWithFormat:@"%@明细",_model.date];
    
    self.isShowBottomBar=YES;

    [self.tableView registerNib:[UINib nibWithNibName:@"SSSRecordOrderToRecordDailyDetailCell" bundle:nil
                                 ] forCellReuseIdentifier:@"SSSRecordOrderToRecordDailyDetailCell"];
    
    [self configData];
    
    
}
-(void)configData{
  
    NSMutableArray *arr=@[].mutableCopy;
    for (int i=0; i<10; i++) {
        SSSRecordOrderModel *model=[SSSRecordOrderModel new];
        model.money=[NSString stringWithFormat:@"1000%.2f",arc4random()%20*1.0];
        
        model.date=@"2017-3-20";
        model.time=@"13:20:09";
        model.phone=@"13320990999";
        model.type=arc4random()%2+1;
        model.customerNumber=@"e7qwtye7ywqewqey";
        model.uploadMoney=@"1700888";
        model.name=@"小明的店";
        model.customerNickname=@"小明没看那个命名";
        model.orderNumber=@"126537621536213567125763";
        model.personName=@"小明";
        [arr addObject:model];
        CGFloat uploadMoney=[model.uploadMoney floatValue ];
        _totalUploadMoney+=uploadMoney;
    }
    
    NSString *str=[NSString stringWithFormat:@"当日上传支付总额 ¥%.2f",_totalUploadMoney];
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
    
        [attr addAttribute:NSFontAttributeName value:Font(15) range:NSMakeRange(0,8)];
    
        [attr addAttribute:NSFontAttributeName value:Font(18) range:NSMakeRange(8, str.length-8)];

    self.bottomBarAttribute=attr;
    self.bottomBar.backgroundColor=[UIColor colorWithHex:@"6D6D6D"];
    self.dataArr=arr.copy;
    [self.tableView reloadData];
    
    
    
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SSSRecordOrderToRecordDailyDetailCell *cell=[tableView dequeueReusableCellWithIdentifier:@"SSSRecordOrderToRecordDailyDetailCell" forIndexPath:indexPath];
    SSSRecordOrderModel *model= self.dataArr[indexPath.row];
    cell.model=model;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 95;
}

@end
